<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>The Standard Numeric Score</title>
    <link rel="stylesheet" type="text/css" href="csound.css" />
    <meta name="generator" content="DocBook XSL Stylesheets V1.78.1" />
    <link rel="home" href="index.html" title="The Canonical Csound Reference Manual" />
    <link rel="up" href="PartOverview.html" title="Part I. Overview" />
    <link rel="prev" href="functional.html" title="Function Syntax in Csound6" />
    <link rel="next" href="ScoreStatements.html" title="Score Statements" />
  </head>
  <body>
    <div class="navheader">
      <table width="100%" summary="Navigation header">
        <tr>
          <th colspan="3" align="center">The Standard Numeric Score</th>
        </tr>
        <tr>
          <td width="20%" align="left"><a accesskey="p" href="functional.html">Prev</a> </td>
          <th width="60%" align="center">Part I. Overview</th>
          <td width="20%" align="right"> <a accesskey="n" href="ScoreStatements.html">Next</a></td>
        </tr>
      </table>
      <hr />
    </div>
    <div class="chapter">
      <div class="titlepage">
        <div>
          <div>
            <h2 class="title"><a id="ScoreTop"></a>The Standard Numeric Score</h2>
          </div>
        </div>
      </div>
      <p>
    The score section contains events that instatiate instruments from the orchestra. There are various score statements that enable complex score building within the csound language.
  </p>
      <p>
    Currently, the maximum length of the score is
    2<sup>31</sup>-1 control periods. For example,
    with kr=1500, you can run a score for a maximum of about 16.5 days
    before problems occur due to overflowing signed 32-bit integer
    variables.  The input token 'z' is read as a number with the value
    of approximately 25367 years.
  </p>
      <p>
    Note also that when using single precision floats (i.e. the 'f'
    installers rather than the 'd' ones), the accuracy of timing
    becomes worse after performing for a long time.
  </p>
      <div class="section">
        <div class="titlepage">
          <div>
            <div>
              <h2 class="title" style="clear: both"><a id="ScorePreproc"></a>Preprocessing of Standard Scores</h2>
            </div>
          </div>
        </div>
        <p>
    A <span class="emphasis"><em>Score</em></span> (a collection of score statements) is divided into time-ordered sections by the <a class="link" href="s.html" title="s Statement"><em class="citetitle">s statement</em></a>. Before being read by the orchestra, a score is preprocessed one section at a time. Each section is normally processed by 3 routines: <a class="link" href="ScoreTop.html#ScoreCarry" title="Carry"><em class="citetitle">Carry</em></a>, <a class="link" href="ScoreTop.html#ScoreTempo" title="Tempo"><em class="citetitle">Tempo</em></a>, and <a class="link" href="ScoreTop.html#ScoreSort" title="Sort"><em class="citetitle">Sort</em></a>.
  </p>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="ScoreCarry"></a>Carry</h3>
              </div>
            </div>
          </div>
          <p>
      Within a group of consecutive <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statements</em></a> whose p1 whole numbers correspond, any pfield left empty will take its value from the same pfield of the preceding statement. An empty pfield can be denoted by a single point (.) delimited by spaces. No point is required after the last nonempty pfield. The output of Carry preprocessing will show the carried values explicitly. The Carry Feature is not affected by intervening comments or blank lines; it is turned off only by a non- <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statement</em></a> or by an <span class="emphasis"><em>i statement</em></span> with unlike p1 whole number.
      <a id="IndexScoreCarry" class="indexterm"></a>
    </p>
          <p>
       Three additional features are available for p2 alone: +, 
^+<span class="emphasis"><em>x</em></span>, and ^-<span class="emphasis"><em>x</em></span>. The symbol + in p2 will be given the value of p2 + p3 from the preceding i statement. This enables note action times to be automatically determined from the sum of preceding durations. The + symbol can itself be carried. It is legal only in p2. E.g.: the statements

      </p>
          <div class="informalexample">
            <pre class="programlisting">
<span class="stamnt">i</span>1   0    .5        100
<span class="stamnt">i</span> .  +
<span class="stamnt">i</span></pre>
          </div>
          <p>

      will result in

      </p>
          <div class="informalexample">
            <pre class="programlisting">
<span class="stamnt">i</span>1   0         .5        100
<span class="stamnt">i</span>1   .5        .5        100
<span class="stamnt">i</span>1   1         .5        100</pre>
          </div>
          <p>
    </p>
          <p>
       The symbols ^+<span class="emphasis"><em>x</em></span> and ^-<span class="emphasis"><em>x</em></span> determine the current p2 by adding or subtracting, respectively, the value of <span class="emphasis"><em>x</em></span> from the preceding p2. These may be used in p2 only and are <span class="emphasis"><em>not</em></span> carried like the + symbol. Note also that there should be no spaces following the ^, the +, or the - parts of these symbols -- the number must come directly after as in ^+2.3.  If the example above had been 

      </p>
          <div class="informalexample">
            <pre class="programlisting">
<span class="stamnt">i</span>1   0    .5        100
<span class="stamnt">i</span> .  ^+1
<span class="stamnt">i</span> .  ^+1</pre>
          </div>
          <p>

      the result would instead be

      </p>
          <div class="informalexample">
            <pre class="programlisting">
<span class="stamnt">i</span>1   0         .5        100
<span class="stamnt">i</span>1   1         .5        100
<span class="stamnt">i</span>1   2         .5        100</pre>
          </div>
          <p>
    </p>
          <p>
       The Carry feature should be used liberally. Its use, especially in large scores, can greatly reduce input typing and will simplify later changes.
    </p>
          <p>
       There can sometimes be circumstances where you do not want "missing" pfields after the last one entered to be implicitly carried.  An example would be an instrument that is designed to take a variable number of pfields.  Beginning with Csound 5.08, you can prevent the implicit carrying of pfields at the end of an i statement by using the symbol ! (called the "no-carry symbol").  The ! must appear at the end of an i statement and it cannot be used in p1, p2, or p3, since these pfields are required.  Here is an example:

      </p>
          <div class="informalexample">
            <pre class="programlisting">
<span class="stamnt">i</span>1   0    .5        100
<span class="stamnt">i</span> .  +
<span class="stamnt">i</span> .  .    .         !
<span class="stamnt">i</span></pre>
          </div>
          <p>

      This score would be interpreted as

      </p>
          <div class="informalexample">
            <pre class="programlisting">
<span class="stamnt">i</span>1   0         .5        100
<span class="stamnt">i</span>1   .5        .5        100
<span class="stamnt">i</span>1   1         .5               ; no p4
<span class="stamnt">i</span>1   1.5       .5               ; only p1 to p3 are carried here</pre>
          </div>
          <p>
    </p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="ScoreTempo"></a>Tempo</h3>
              </div>
            </div>
          </div>
          <p>
       This operation time warps a score section according to the information in a <a class="link" href="t.html" title="t Statement (Tempo Statement)"><em class="citetitle">t statement</em></a>. The tempo operation converts p2 (and, for <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statements</em></a>, p3) from original beats into real seconds, since those are the units required by the orchestra. After time warping, score files will be seen to have orchestra-readable format demonstrated by the following:
       </p>
          <pre class="programlisting"><span class="stamnt">i</span> p1 p2beats p2seconds p3beats p3seconds p4 p5 ....</pre>
          <p>
      <a id="IndexScoreTempo" class="indexterm"></a>
    </p>
        </div>
        <div class="section">
          <div class="titlepage">
            <div>
              <div>
                <h3 class="title"><a id="ScoreSort"></a>Sort</h3>
              </div>
            </div>
          </div>
          <p>
       This routine sorts all action-time statements into chronological order by p2 value. It also sorts coincident events into precedence order. Whenever an <a class="link" href="f.html" title="f Statement (or Function Table Statement)"><em class="citetitle">f statement</em></a> and an <a class="link" href="i.html" title="i Statement (Instrument or Note Statement)"><em class="citetitle">i statement</em></a> have the same p2 value, the <span class="emphasis"><em>f statement</em></span> will precede. Whenever two or more <span class="emphasis"><em>i statements</em></span> have the same p2 value, they will be sorted into ascending p1 value order. If they also have the same p1 value, they will be sorted into ascending p3 value order. Score sorting is done section by section (see <a class="link" href="s.html" title="s Statement"><em class="citetitle">s statement</em></a>). Automatic sorting implies that score statements may appear in any order within a section.
      <a id="IndexScoreSort" class="indexterm"></a>
    </p>
          <div class="note" style="margin-left: 0.5in; margin-right: 0.5in;">
            <table border="0" summary="Note">
              <tr>
                <td rowspan="2" align="center" valign="top" width="25">
                  <img alt="[Note]" src="images/note.png" />
                </td>
                <th align="left">Note</th>
              </tr>
              <tr>
                <td align="left" valign="top">
                  <p>
        The operations Carry, Tempo and Sort are combined in a 3-phase single pass over a score file, to produce a new file in orchestra-readable format ( see the Tempo example). Processing can be invoked either explicitly by the <span class="emphasis"><em>Scsort</em></span> command, or implicitly by Csound which processes the score before calling the orchestra. Source-format files and orchestra-readable files are both in ASCII character form, and may be either perused or further modified by standard text editors. User-written routines can be used to modify score files before or after the above processes, provided the final orchestra-readable statement format is not violated. Sections of different formats can be sequentially batched; and sections of like format can be merged for automatic sorting.
      </p>
                </td>
              </tr>
            </table>
          </div>
        </div>
      </div>
    </div>
    <div class="navfooter">
      <hr />
      <table width="100%" summary="Navigation footer">
        <tr>
          <td width="40%" align="left"><a accesskey="p" href="functional.html">Prev</a> </td>
          <td width="20%" align="center">
            <a accesskey="u" href="PartOverview.html">Up</a>
          </td>
          <td width="40%" align="right"> <a accesskey="n" href="ScoreStatements.html">Next</a></td>
        </tr>
        <tr>
          <td width="40%" align="left" valign="top">Function Syntax in Csound6 </td>
          <td width="20%" align="center">
            <a accesskey="h" href="index.html">Home</a>
          </td>
          <td width="40%" align="right" valign="top"> Score Statements</td>
        </tr>
      </table>
    </div>
  </body>
</html>
